<!-- BEGIN:main -->

<script>

    $(function() {
        $("#datepicker").datepicker({
            changeMonth: true,
            changeYear: true
        });

    });


    function submitForm(ac)
    {
        var title = $('#txtTitle');
        var alias = $('#txtAlias');
        var categoryID = $('#slCategoryID');

        if (alias.val() == '') {
            alias.val(title.val());
        }


        var arrayInput = new Array(title, categoryID);

        var hasError = validateEmptyValue(arrayInput);



        // kiểm tra giá trị hợp lệ
        if (hasError) {
            alert("Vui lòng điền đầy đủ thông tin");
        } else {
            var form = document.phpForm;
            form.hdAction.value = ac;
            form.submit();
        }


        //            if (CKEDITOR.instances['txtDescription'].getData() == "")
        //            {
        //                alert('Vui lòng nhập nội dung mô tả');
        //                CKEDITOR.instances['txtDescription'].focus();
        //                return;
        //            }
        //            else if (CKEDITOR.instances['txtContent'].getData() == "")
        //            {
        //                alert('Vui lòng nhập nội dung chi tiết');
        //                CKEDITOR.instances['txtContent'].focus();
        //                return;
        //            }


    }


    // hàm mở popup duyệt file trên máy chủ
    function BrowseServer() {
        var finder = new CKFinder();
        finder.BasePath = '../blugin/ckeditor3.6.4/ckfinder/';
        finder.startupPath = "Images:/images/";
        finder.SelectFunction = SetFileField;
        finder.Popup();
    }


    // hàm gán giá trị chọn file trên máy chủ vào trường image
    function SetFileField(fileUrl) {
        document.getElementById('txtImage').value = fileUrl;
        document.getElementById('hdImage').value = fileUrl;
    }


</script>





<div id="toolbar-box">
    <div class="d_divide5"></div>
    <div class="toolbar" id="toolbar">
        <table class="toolbar">
            <tr>
                <td class="button" id="toolbar-save">
                    <a href="javascript:void()" onclick="submitForm('editAndExit')" class="toolbar">
                        <span class="icon-32-save" title="Lưu và Đóng"></span>
                        Lưu & Đóng
                    </a>
                </td>

                <td class="button" id="toolbar-apply">
                    <a href="javascript:void()" onclick="submitForm('edit')" class="toolbar">
                        <span class="icon-32-apply" title="Áp dụng"></span>
                        Lưu
                    </a>
                </td>

                <td class="button" id="toolbar-cancel">
                    <a href=".?com=com_article&view=article&task=view" class="toolbar">
                        <span class="icon-32-cancel" title="Hủy"></span>
                        Hủy
                    </a>
                </td>												
            </tr>
        </table>
    </div>
    <div class="header icon_48_article_edit">
        Bài viết: <small><small>[ Chỉnh sửa ]</small></small>
    </div>

    <div class="d_divide5"></div>
</div>

<div class="d_divide10"></div>
<div class="d_clear"></div>

<div id="element-box">


    <form method="post" name="phpForm">

        <table cellspacing="0" cellpadding="0" border="0" width="100%">
            <tr>
                <td valign="top">                
                    <table  class="adminform">
                        <tr>
                            <td>
                                <label for="txtTitle" class="d_label">Tiêu đề bài viết: <b style="color: red;font-size: 14px;">*</b></label>
                            </td>
                            <td>
                                <input  class="d_text_input" type="text" name="txtTitle" id="txtTitle" style="width: 350px;" maxlength="255" value="{TITLE}" title="Tiêu đề" />
                            </td>
                            <td> 
                                <label for="txtAlias" class="d_label">Alias (Định danh)</label>
                            </td>
                            <td>
                                <input class="d_text_input" type="text" name="txtAlias" id="txtAlias" style="width: 350px; " maxlength="255" value="{ALIAS}" title="alias" />                                
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <label for="slCategoryID" class="d_label">Nhóm tin: <b style="color: red;font-size: 14px;">*</b></label>
                            </td>

                            <td>
                                <select size="1" style="width: 350px;"  class="d_text_input" name="slCategoryID" id="slCategoryID">
                                    <option value="" selected>-- Chọn nhóm tin --</option>
                                    <!-- BEGIN:category_list -->
                                    <OPTION {SELECTED_CATEGORY} value={CATEGORY_ID}>{CATEGORY_TITLE}</OPTION>                                            
                                    <!-- END:category_list -->
                                </select>
                            </td>

                            <td>
                                <label for="datepicker" class="d_label">Ngày tạo</label>
                            </td>
                            <td>                                                
                                <input class="d_text_input" value="{MODIFIED_DATE}"  id="datepicker" style="width: 110px;" name="modifiedDate" />                                
                            </td>
                        </tr>

                        <tr>
                            <td>
                                <label for="txtImage" class="d_label">Ảnh đại diện:</label>
                            </td>
                            <td>
                                <div style="float: left;">
                                    <input class="d_text_input" style="background: #ffffff;" type="text" id="txtImage" name="txtImage" value="{IMAGE}" disabled="disabled" size="50" />
                                    <input type="hidden" id="hdImage" name="hdImage" value="{IMAGE}" />
                                </div>


                                <input type="button" class="d_button" value="Chọn ảnh" onclick="javascript:BrowseServer()"/>



                            </td>
                            <td>
                                <label class="d_label">Hiển thị ảnh đại diện</label>
                            </td>
                            <td>
                                <!-- BEGIN:image_status_true -->
                                <input type="radio" name="rdoImageStatus" id="rdoImageStatus0" value="0"  />
                                <label>Không</label>
                                <input type="radio" name="rdoImageStatus" id="rdoImageStatus1" value="1" checked="checked"  />
                                <label>Có</label>
                                <!-- END:image_status_true -->

                                <!-- BEGIN:image_status_false -->
                                <input type="radio" name="rdoImageStatus" id="rdoImageStatus0" value="0" checked="checked"/>
                                <label>Không</label>
                                <input type="radio" name="rdoImageStatus" id="rdoImageStatus1" value="1"  />
                                <label>Có</label>
                                <!-- END:image_status_false -->                                                
                            </td>
                        </tr>       

                        <tr>
                            <td>
                                <label for="alias" class="d_label">Bật/Tắt bài viết:</label>
                            </td>
                            <td>
                                <!-- BEGIN:status_true -->
                                <input type="radio" name="rdoStatus" id="rdoStatus0" value="0"  />
                                <label>Tắt</label>
                                <input type="radio" name="rdoStatus" id="rdoStatus1" value="1" checked="checked"  />
                                <label>Bật</label>
                                <!-- END:status_true -->                                                 

                                <!-- BEGIN:status_false -->
                                <input type="radio" name="rdoStatus" id="rdoStatus0" value="0" checked="checked" />
                                <label>Tắt</label>
                                <input type="radio" name="rdoStatus" id="rdoStatus1" value="1" />
                                <label>Bật</label>  
                                <!-- END:status_false --> 

                            </td>
                            <td>
                                <label class="d_label">Là bài viết nổi bật</label>
                            </td>
                            <td>
                                <!-- BEGIN:highlight_true -->
                                <input type="radio" name="rdoHighLight" id="rdoHighLight0" value="0" />
                                <label>Không</label>
                                <input type="radio" name="rdoHighLight" id="rdoHighLight1" value="1" checked="checked"/>
                                <label>Có</label>
                                <!-- END:highlight_true --> 

                                <!-- BEGIN:highlight_false -->
                                <input type="radio" name="rdoHighLight" id="rdoHighLight0" value="0" checked="checked" />
                                <label>Không</label>
                                <input type="radio" name="rdoHighLight" id="rdoHighLight1" value="1" />
                                <label>Có</label>
                                <!-- END:highlight_false --> 

                            </td>
                        </tr> 


                    </table>
                </td>            
            </tr>
        </table>


        <table class="adminform">
            <tr>
                <td style="text-align: center">

                    <div class="d_divide10"></div>
                    <label style="font-weight:bold ">Nội dung mô tả:</label>
                    <div class="d_divide10"></div>

                    <textarea name="txtDescription" id="txtDescription">{DESCRIPTION}</textarea>

                    <script language="javascript" type="text/javascript">
                        CKEDITOR.replace('txtDescription',
                        {
                            filebrowserBrowseUrl: '../blugin/ckeditor3.6.4/ckfinder/ckfinder.html',
                            filebrowserImageBrowseUrl: '../blugin/ckeditor3.6.4/ckfinder/ckfinder.html?type=Images',
                            filebrowserFlashBrowseUrl: '../blugin/ckeditor3.6.4/ckfinder/ckfinder.html?type=Flash',
                            height: 250,
                            toolbarStartupExpanded: false
                        });
                    </script>

                    <div class="d_divide10"></div>
                    <label style="font-weight:bold ">Nội dung chi tiết: </label>
                    <div class="d_divide10"></div>

                    <textarea name="txtContent" id="txtContent">{CONTENT}</textarea>

                    <script language="javascript" type="text/javascript">
                        CKEDITOR.replace('txtContent',
                        {
                            filebrowserBrowseUrl: '../blugin/ckeditor3.6.4/ckfinder/ckfinder.html',
                            filebrowserImageBrowseUrl: '../blugin/ckeditor3.6.4/ckfinder/ckfinder.html?type=Images',
                            filebrowserFlashBrowseUrl: '../blugin/ckeditor3.6.4/ckfinder/ckfinder.html?type=Flash',
                            height: 450,
                            toolbarStartupExpanded: true
                        });
                    </script>

                </td>
            </tr>
        </table>
        <input type="hidden" name="hdAction" value=""/>
        <!--                        <input type="hidden" name="hdCreatedUserID" value="{CREATED_USER_ID}"/>
                                <input type="hidden" name="hdCreatedDate" value="{CREATED_DATE}"/>-->
        <input type="hidden" name="hdArticleID" value="{ARTICLE_ID}"/>

    </form>


</div>
<noscript>
!Cảnh báo! Javascript phải được bật để chạy được các chức năng trong phần Quản trị		</noscript>



<!-- END:main -->	